<template>
  <router-link
    :to="{
      name: 'meizi-detail',
      params: {
        id: meizi._id
      }
    }"
    class="item">
    <div class="title">{{ meizi.title }}</div>
    <img :src="meizi.images[0]" alt="">
    <div class="desc">{{ meizi.desc }}</div>
    <div class="other">
      <span>{{ meizi.createdAt }}</span>
      <span>{{ meizi.author }}</span>
    </div>
  </router-link>
</template>

<script>
export default {
  name: "MeiziComponent",
  props: {
    meizi: {
      type: Object,
      required: true
    }
  }
}
</script>

<!-- css预处理器 less, scss & sass, stylus, postcss... -->
<!-- .less -->
<style scoped lang="less">
.item {
  display: block;
  border-bottom: 2px solid cadetblue;
  padding: 10px;

  .title {
    font-size: 20px;
    font-weight: bold;
  }

  img {
    width: 100%;
    height: 200px;
    border: 1px solid #aaa;
    object-fit: cover;
  }
}
</style>
